﻿using System;

namespace PokerAssistant.Models
{
    public class Kaart
    {
        public bool Valitud { get; set; }
        public int Tugevus { get; private set; }
        public Mast Mast { get; private set; }

        public string TugevusString
        {
            get
            {
                if (Tugevus == 10) return "T";
                if (Tugevus == 11) return "J";
                if (Tugevus == 12) return "Q";
                if (Tugevus == 13) return "K";
                if (Tugevus == 14) return "A";

                return Tugevus.ToString();
            }
        }

        public string MastString
        {
            get
            {
                if (Mast == Mast.POTI) return "s";
                if (Mast == Mast.ÄRTU) return "h";
                if (Mast == Mast.RISTI) return "c";
                if (Mast == Mast.RUUTU) return "d";

                return "-";
            }
        }

        public string KaardiKood
        {
            get { return String.Format("{0}{1}", TugevusString, MastString); }
        }

        public Kaart(int tugevus, Mast mast)
        {
            Tugevus = tugevus;
            Mast = mast;
        }

        public override bool Equals(object other)
        {
            var teineKaart = other as Kaart;
            if (teineKaart == null)
                return false;

            return Tugevus == teineKaart.Tugevus && Mast == teineKaart.Mast;
        }

        public override string ToString()
        {
            return KaardiKood;
        }
    }
}